/*
 * @author hope.chen, QQ:77132995, email:kazeik@163.com
 * 2020-10-10 12:43
 * 类说明:
 */
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_scan_crop/page/HomePage.dart';
import 'package:image_scan_crop/page/ItemChoicePage.dart';
import 'package:image_scan_crop/page/any_angle_crop_page.dart';
import 'package:image_scan_crop/page/image_crop_page.dart';
import 'package:image_scan_crop/page/prospect_page.dart';
import 'package:image_scan_crop/page/zoom_view_page.dart';
import 'package:image_scan_crop/utils/DRouters.dart';

import 'package:event_bus/event_bus.dart';

// waitRelogin(BuildContext _context) async {
//   await Utils.removeInfo("token");
//   ApiUtils.loginToken = null;
//   Navigator.pushAndRemoveUntil(_context,
//       new MaterialPageRoute(builder: (BuildContext c) {
//     return LoginPage();
//   }), (r) => r == null);
// }

final EventBus eventBus = EventBus();

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => ScreenUtilInit(
        designSize: const Size(375, 667),
        builder: () => MaterialApp(
          title: '测试',
          debugShowCheckedModeBanner: false,
          navigatorKey: DRouters.navigatorKey,
          theme: ThemeData(
            primarySwatch: Colors.orange,
            primaryColorBrightness: Brightness.light,
            // accentColorBrightness:Brightness.light,
            // brightness: Brightness.dark,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          builder: (context, child) => FlutterEasyLoading(child: child),
          color: Colors.white,
          initialRoute: '/main',
          routes: <String, WidgetBuilder>{
            '/main': (context) => HomePage(),
            '/itemChoice': (context) => const ItemChoicePage(),
            '/image_crop': (context) => ImageCropPage(),
            '/prospect': (context) => const ProspectPage(),
            '/zoom_view': (context) => const ZoomViewPage(),
            '/any_rangle_crop': (context) => AnyRangleCropPage(),
          },
        ),
      );
}
